package com.haiyou.dc.thread.test4;

public class TestThread {

    private transient boolean flag = false;

    public static void main(String[] args) {
        new TestThread().test();

    }

    public void test() {
        new Thread(() -> {

            while (!flag) {
                System.out.println("-------->");
            }

        }).start();

        new Thread(() -> {
            flag = true;
            System.out.println("flag==>" + flag);
        }).run();

        while (true) {

        }
    }
}
